<template>
  <div class="new">
    <h3>{{ i.name }}</h3>
    <ul>
      <li v-for="item in i.goodsList" :key="item.id" @click="gotoDetail(item)">
        <!-- 注意这里src要动态绑定 -->
        <img v-lazy="item.list_pic_url" alt="" />
        <p class="p1">{{ item.name }}</p>
        <p class="p2">{{ item.retail_price | formatMoney }}</p>
      </li>
    </ul>
  </div>
</template>

<script>
export default {
  name: "HomeE",
  props: ["i"],
  data() {
    return {};
  },
  created() {
    // setTimeout(() => {
    //   console.log(this.i);
    // }, 200);
  },
  methods: {
    gotoDetail(i) {
      this.$router.push({ path: "/xq", query: { id: i.id } });
    },
  },
};
</script>

<style lang='less' scoped>
.new ul {
  display: flex;
  flex-wrap: wrap;

  li {
    width: 48%;
    img {
      width: 100%;
    }
    .p1 {
      font-size: 16px;
      text-align: center;
    }
    .p2 {
      color: red;
      font-size: 16px;
      text-align: center;
      margin-top: 10px;
    }
  }
}
h3 {
  font-size: 18px;
  margin-top: 40px;
  text-align: center;
  margin-bottom: 30px;
}
</style>